﻿CREATE PROCEDURE [dbo].[yaf_post_list_reverse10](
                @TopicID INT)
AS
    BEGIN
        SET nocount  ON
        SELECT   TOP 10 a.Posted,
                        Subject = d.Topic,
                        a.Message,
                        a.UserID,
                        a.Flags,
                        UserName = Isnull(a.UserName,b.Name),
                        b.Signature
        FROM     yaf_Message a,
                 yaf_User b,
                 yaf_Topic d
        WHERE    (a.Flags & 24) = 16
        AND a.TopicID = @TopicID
        AND b.UserID = a.UserID
        AND d.TopicID = a.TopicID
        ORDER BY a.Posted DESC
    END


